<!doctype html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../../css/mui.min.css" rel="stylesheet" />
	</head>
	<style>
		#container {
			width: 100%;
			height: 520px;
			background: #0062CC;
		}
	</style>
	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-back  mui-icon-backmui-pull-left"></a>
			<h1 class="mui-title">位置查看</h1>
		</header>
		<div class="mui-content">
			<div id="container" style="background: #F2F2F2;">
				<div class="" style="margin-top: 50%;margin-left: 50%;">
					<span class="mui-spinner" style="font-size: 50px;"></span>
				</div>
			</div>
			<div class="mui-row">
				<button class="mui-btn mui-btn-block" id="map">导航去这里</button>
			</div>
		</div>
	</body>
	<script src="../../js/mui.min.js"></script>
	<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=eSGUs0FsA6V5Kz8E79ioi42mvSKYeY9Q"></script>
	<script type="text/javascript" src="http://developer.baidu.com/map/jsdemo/demo/convertor.js"></script>
	<script type="text/javascript">
		mui.init()
		mui.plusReady(function() {
			var longitude, latitude;
			var map = new BMap.Map("container");
			plus.geolocation.getCurrentPosition(translatePoint, function(e) {
				mui.toast("异常:" + e.message);
			});
			function translatePoint(position) {
				/*				var currentLon = position.coords.longitude;
								var currentLat = position.coords.latitude;*/
				//设置公司固定地址地址
				var currentLon = 120.001965;
				var currentLat = 30.290184;

				var gpsPoint = new BMap.Point(currentLon, currentLat);
				BMap.Convertor.translate(gpsPoint, 2, initMap); //坐标转换
			}
			function initMap(point) {
				map = new BMap.Map("container"); //创建地图
				map.addControl(new BMap.NavigationControl());
				map.addControl(new BMap.ScaleControl());
				map.addControl(new BMap.OverviewMapControl());
				map.centerAndZoom(point, 15);
				map.addOverlay(new BMap.Marker(point));
				map.addControl(new BMap.MapTypeControl());
				map.addEventListener("click", function(e) {
					mui.toast("杭州鹿角科技有限公司")
				});
			}
		});
		document.getElementById('map').addEventListener('tap', function() {
			// 调起百度地图 
			// http://lbsyun.baidu.com/index.php?title=uri/api/android
			// iOS端
			var href = "baidumap://map/geocoder?address=仓兴街1号梦想小镇创业大街8幢&src=webapp.geo.yourCompanyName.yourAppName";
			// Android端
			var anhref = "bdapp://map/geocoder?address=仓兴街1号梦想小镇创业大街8幢&src=openApiDemo"
			var osName = plus.os.name;
			if(osName == "iOS") {
				window.open(href);
			} else if(osName == "Android") {
				window.open(anhref);
			} else {
				mui.toast('对不起，您未安装百度地图，不能使用该功能');
			}
		})
	</script>

</html>